package com.lxg.service.userService.impl;

import com.lxg.dao.ProblemDao;
import com.lxg.pojo.Books;
import com.lxg.pojo.Problem;
import com.lxg.service.userService.UserProblemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class UserProblemServiceImpl implements UserProblemService {
    @Autowired
    ProblemDao problemDao;

    /**
     * 添加一个问题
     * @param uid
     * @param name
     * @param page
     * @param body
     * @param phone
     * @return
     */
    @Override
    public boolean addProblem(Integer uid, String name, String page, String body, String phone) {
        problemDao.addProblem(uid, name, page, body, phone);
        return true;
    }

    @Override
    public ArrayList<Problem> getAllProblems() {
        ArrayList<Problem> allProblem = problemDao.getAllProblem();
        return allProblem;
    }

    @Override
    public ArrayList<Problem> getProblemsByUid(Integer uid) {
        ArrayList<Problem> problemByUid = problemDao.getProblemByUid(uid);
        return problemByUid;
    }

    @Override
    public ArrayList<Problem> getProblemsByLikeName(String name) {
        ArrayList<Problem> problemByLikeName = problemDao.getProblemByLikeName(name);
        return problemByLikeName;
    }

    @Override
    public ArrayList<Problem> getProblemsByLikeBody(String body) {
        ArrayList<Problem> problemByLikeBody = problemDao.getProblemByLikeBody(body);
        return problemByLikeBody;
    }
}
